﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ModBot.ConfigBuilder.CustomControls
{
    public partial class TargetTypeBuildControl : UserControl
    {
        public ModBot.ConfigBuilder.Forms.TargetTypeOption TargetTypeOption { get; set; }

        public TargetTypeBuildControl()
        {
            InitializeComponent();
            TargetTypeOption = ModBot.ConfigBuilder.Forms.TargetTypeOption.Heals;
        }

        public string TargetTypeText
        {
            get { return this.targetTypeTextbox.Text; }
            set 
            { 
                this.targetTypeTextbox.Text  = value;
                Application.DoEvents();
            }
        }

        private void targetTypeBuildButton_Click(object sender, EventArgs e)
        {
            Forms.TargetTypeBuilderForm form = new Forms.TargetTypeBuilderForm();
            if (TargetTypeText.Length > 0) form.SetTargetTypeSelections(TargetTypeText, Globals.TargetTypeDelimeter);
            form.TargetTypeOption = TargetTypeOption;
            
            form.ShowDialog(this);
            if (!form.IsCancelled)
            {
                string targetTypeText = form.GetTargetTypeText();
                this.TargetTypeText = targetTypeText;
            }
        }

        
    }
}
